<h3>Register new Question</h3>

<form>
	<fieldset><legend>Enter Question and Answer alternatives</legend>
		<label for="question-text">Question Text:</label>
		<input id="question-text" name="question" type="text" size="35" value="<%=this.question.attr('text')%>"/>
		
		<hr />
		
		<p>Possible Answers:</p>
		
		<ul id="possible-answers">
			<% for(var i=0; i < this.question.answers.length; i++) { %>
				<li>
					<label for="answer-<%=i%>">Answer <%=i%></label>
					<input id="answer-<%=i%>" class="answer-text" role="<%=i%>" type="text" name="answer-<%=i%>" value="<%=this.question.answers[i].attr('text')%>"/>
					<input type="button" class="remove-answer" role="<%=i%>" value="X"/>
					<ul>
					<% for (var x=0; x < this.question.answers[i].dnaAssignments.length; x++) { %>
						<li>
							Add
							<select name="answer-<%=i%>-dna-<%=x%>-amount" class="dna-amount-chooser" role="<%=i%>,<%=x%>">
							<% for(var a=1; a <= 5; a++) { %>
								<option value="<%=a%>" 
									<% if(this.question.answers[i].dnaAssignments[x].attr('amount')===a) { %>selected="selected"<% } %>
								>
									<%=a%>
								</option>
							<% } %>
							</select>
							To
							<select name="answer-<%=i%>-dna-<%=x%>-type" class="dna-type-chooser" role="<%=i%>,<%=x%>">
							<% for(var d=0; d < this.dnaTypes.length; d++) { %>
								<option value="<%=this.dnaTypes[d].attr('id')%>"
									<% if(this.question.answers[i].dnaAssignments[x].dna.attr('id')===this.dnaTypes[d].attr('id')) { %>selected="selected"<% } %>
								>
									<%=this.dnaTypes[d].attr('name')%>
								</option>
							<% } %>
							</select>
							For
							<select id="answer-<%=i%>-dna-<%=x%>-for" class="dna-for-chooser" role="<%=i%>,<%=x%>">
								<option value="1" <% if(this.question.answers[i].dnaAssignments[x].attr('presentee')) { %>selected="selected"<% } %>>Presentee</option>
								<option value="0" <% if(!this.question.answers[i].dnaAssignments[x].attr('presentee')) { %>selected="selected"<% } %>>Donor</option>
							</select>
							
							<input type="button" value="X" id="remove-answer-dna" role="<%=i%>,<%=x%>"/>
						</li>
						<% } %>
						<li>
							<input type="button" id="add-answer-dna" value="add DNA" role="<%=i%>"/>
						</li>
					</ul>
				</li>
			<% } %>
		</ul>
					
		<input id="add-answer" type="button" value="Add Answer"/></p>
		
		<input id="submit-question" type="button" value="Submit"/>
	</fieldset>

</form>